home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-04-24 | 1.5 KB | 50 lines | [TEXT/MPS ] |
- % ---------------------------------------------------------------------------
- % Class DefaultMenuProcess
- %
- % Part of the Lund Software interface to Macintosh Toolbox
- % DefaultMenuProcess is designed to act as a process under the
- % MACProcessMGR. It receives events marked as "inMenuBar" and
- % will activate the appropriate menu.
- %
- % 890412/Boris Magnusson
- %
- % ---------------------------------------------------------------------------
- External class MacPoint="::Sinterfaces:MacPoint";
- External class MacEvent="::Sinterfaces:MacEvent";
- External class MacProcess="::SInterfaces:MacProcess";
- External class MacMenuBar="::SInterfaces:MacMenuBar";
- MacProcess class DefaultMenuProcess(bar);
- ref(macmenubar) bar;
- begin
- integer find; ! result code from "findWindow" ;
- integer menu_item,menuId,item; ! menuSelect result;
- ref(macEvent) myevent;
- ref(macpoint) aPoint;
- aPoint:-new macPoint;
- myEvent:- new MacEvent;
- enableEvent(TConst.mouseDown);
- enableEvent(Tconst.keydown);
-
- while true do
- begin
- find:=waitnextevent(myEvent); ! wait for next event targeted at bar;
- if find=Tconst.inMenubar then
- begin
- myEvent.copypoint(aPoint);
- menu_item:=bar.MenuSelect(aPoint);
- end
- else if util.bitAnd(myEvent.modifiers,TConst.cmdKey)<>0 then
- menu_item:=bar.menukey(
- char(Util.bitAnd(myEvent.message,tconst.charcodemask)))
- else
- menu_item:=0;
- MenuID:=util.hiWord(menu_item);
- item:=Util.loWord(menu_item);
- if MenuID<>0 then
- begin
- bar.findmenu(MenuID).doMenu(menuID,item);
- bar.hiliteMenu(0);
- end;
- end -- for ever -- ;
-
- END --- Default Menu Process --- ;